{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "34b21b8a",
   "metadata": {},
   "source": [
    "* 时间：2022/10/18 week09\n",
    "* recoder: 小圆"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0bbdf579",
   "metadata": {},
   "source": [
    "# 本周知识点\n",
    "\n",
    "> 1.while循环\n",
    "\n",
    "> 2.购物车练习\n",
    "\n",
    "> 3.元组_集合"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "ec909bd9",
   "metadata": {},
   "outputs": [],
   "source": [
    "# while True 可以实现for + range 的方法\n",
    "# while True"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "227aa151",
   "metadata": {},
   "outputs": [],
   "source": [
    "# 猜数字小游戏： 0<n<100,5次机会猜数字，每次猜完出题人提示你猜的有点大/有点小\n",
    "\n",
    "hide_card = int(input(\"hide_card\")) # 出题人\n",
    "count = 0"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "f43f4991",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入数字在0-99之间，不要耍赖！\n"
     ]
    }
   ],
   "source": [
    "import getpass\n",
    "hide_card = int(getpass)\n",
    "\n",
    "\n",
    "\n",
    "if hide_card <100 and hide_card>0 :\n",
    "    print(\"游戏开始了\")\n",
    "    while True:\n",
    "        if count <5:\n",
    "            guess_digit = int(input(\"guess_digit\")) # 玩游戏的人\n",
    "            if guess_digit == hide_card:\n",
    "                print(\"yes,you got it\")\n",
    "            elif guess_digit > hide_card:\n",
    "                print(\"往小了想想.\")\n",
    "            else:\n",
    "                print(\"往大了猜.\")\n",
    "            count = count+1\n",
    "        else:\n",
    "            print(\"猜这么多次都不对，是不是笨蛋？\")\n",
    "            print(\"正确答案是： %s\"%hide_card)\n",
    "            break\n",
    "            count = count+1\n",
    "else:\n",
    "    print(\"请输入数字在0-99之间，不要耍赖！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "07ee9f00",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
